package org.example.service.impl;

import org.example.service.MailService;
import org.example.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserServiceImpl implements UserService {

    MailService mailService;

    @Override
    public void register(String mail) {

        mailService.sendMail(mail);
        System.out.println("Registering successfully");
    }
    public UserServiceImpl(MailService mailService) {
        this.mailService = mailService;
    }

/*    public void setMailService(MailService mailService) {
        this.mailService = mailService;
    }*/

    public static void main(String[] args) {
        ApplicationContext context =new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = (UserService) context.getBean("userService");
        userService.register("sfds484");
    }
}
